package org.nobject.common.swing.g;

import java.awt.Container;
import java.awt.Graphics;
import java.awt.event.ActionListener;

import javax.swing.JMenuItem;

/**
 * GMenuItem
 *
 * @author bianrongjun
 * @version 1.0
 */
public class GMenuItem extends JMenuItem  implements IG{

	/**
	 * 构造函数 
	 */
	public GMenuItem() {
		super();
		this.core=new GComponent();
	}

	/**
	 * 构造函数 
	 * @param text
	 */
	public GMenuItem(String text) {
		this();
		if (text != null) this.setText(text);
	}
	
	/**
	 * 构造函数 
	 * @param text
	 * @param actionListener
	 */
	public GMenuItem(String text,ActionListener actionListener) {
		this();
		if (text != null) this.setText(text);
		if(actionListener!=null) this.addActionListener(actionListener);
	}

	/**
	 * 构造函数 
	 * @param container
	 * @param name
	 * @param text
	 * @param actionListener
	 */
	public GMenuItem(Container container,String text,ActionListener actionListener) {
		this();
		if (text != null) this.setText(text);
		container.add(this);
		this.addActionListener(actionListener);
	}
	
	/** IG */
	private GComponent core;
	public GComponent getGCore() {return core;}
	
	
	public void paintChildren(Graphics g) {core.paintChildren(g);super.paintChildren(g);}
}
